#include <QBoxLayout>
#include <QPainter>

#include "workspacetabs.h"

#include "workspace.h"

Workspace::Workspace(QWidget *parent) : QWidget(parent),
    m_tabBar(new WorkspaceTabs(this))
{
    //Set properties.
    setAutoFillBackground(true);
    setContentsMargins(0, 0, 0, 0);
    //Set layout.
    QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
    mainLayout->setContentsMargins(0, 0, 0, 0);
    mainLayout->setSpacing(0);
    setLayout(mainLayout);
    //Add the widgets of the workspace panel.
    QBoxLayout *titleLayout = new QBoxLayout(QBoxLayout::LeftToRight);
    titleLayout->setContentsMargins(0, 0, 0, 0);
    titleLayout->setSpacing(0);
    mainLayout->addLayout(titleLayout);
    mainLayout->addSpacing(1);
    mainLayout->addStretch();
    //Add widget.
    titleLayout->addWidget(m_tabBar, 1);
}

void Workspace::paintEvent(QPaintEvent *event)
{
    Q_UNUSED(event)
    QPainter painter(this);
    painter.setPen(QColor(209, 209, 209));
    painter.drawLine(0, 27, width(), 27);
}
